﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AttendanceDataInteraction
{
    public class Utility
    {
        public static byte[] GetDateTimeBytes(DateTime dt)
        {
            byte[] retBytes = new byte[7];
            string dateStr = dt.ToString("yyyyMMddHHmmss");
            retBytes[0] = byte.Parse(dateStr.Substring(0, 2));
            retBytes[1] = byte.Parse(dateStr.Substring(2, 2));
            retBytes[2] = byte.Parse(dateStr.Substring(4, 2));
            retBytes[3] = byte.Parse(dateStr.Substring(6, 2));
            retBytes[4] = byte.Parse(dateStr.Substring(8, 2));
            retBytes[5] = byte.Parse(dateStr.Substring(10, 2));
            retBytes[6] = byte.Parse(dateStr.Substring(12, 2));
            return retBytes;
        } 
    }
}
